<template>
  <div>
    <c-title :text="text"></c-title>
    <bind :course_name="course_name" :url="url"></bind>
  </div>
</template>

<script>
import bind from "./components/bind.vue"
export default {
  components: {  bind },
  data(){
    return {
      text:"",
      url:"",
      course_name:"",
    }
  },
  activated(){
    this.getData()
  },
  methods:{
    getData(){
      $http.get('plugin.water-machine.frontend.consumer.member-card.index',{},"").then(res => {
        if (res.result) {
          // if (res.data.device_no == "" && this.device_no=="") {
          //   Dialog.alert({
          //     message: '请扫打水机设备码',
          //   }).then(() => {
          //     window.location.href=res.data.course_h5_url;
          //   });
          //   return;
          // };
          // this.member = res.data.member;

          // if (res.data.member) {
          //   this.type = 2;
          //   this.member = res.data.member;
          // } else {
          //   this.type = 1;
          // }

          let basic_info = JSON.parse(localStorage.getItem("yz_basic_info")) || res.basic_info;
          let text =  basic_info&&basic_info.plugin_setting.water_machine_header;
          this.text =text
          this.fun.setWXTitle(text)
          this.url = res.data.course_url;
          this.course_name = res.data.course_name;
        } else {
          this.$toast(res.msg);
        }
      })
    }
  }
};
</script>

<style scoped lang="scss">

</style>
